DigiLocker Fetch All Documents API
The following document highlights the details of the DigiLocker Fetch All Documents API.
API Description
Objective
The DigiLocker Fetch All Documents API retrieves and returns all available documents from Digilocker.
| Input | Output |
|---|---|
| A unique reference identifier and file parameter | All available documents from Digilocker including document types, URIs, and extracted data (name, address, date of birth, gender, photo, etc.) |
API URL
https://ind-verify.hyperverge.co/api/digilocker/fetchAllDocuments
API Endpoint
fetchAllDocuments
Overview
The DigiLocker Fetch All Documents API is RESTful and uses standard HTTP verbs and status codes. The responses are in JSON format and you should upload all images and files as form-data through a POST request.
Method - POST
Authentication
You need a unique pair of application ID ( appId ) and application key ( appKey ) from HyperVerge to verify your identity for accessing the API.
Headers
| Header | Mandatory / Optional | Description | Input Format |
|---|---|---|---|
| content-type | Mandatory | This parameter defines the media type for the request payload | application/json |
| appId | Mandatory | The application identifier shared by HyperVerge. You can find the details in the dashboard's credentials tab | This should be a unique value |
| appKey | Mandatory | The application key shared by HyperVerge. You can find the details in the dashboard's credentials tab | This should be a unique value |
| transactionId | Optional | A unique identifier for tracking a user journey | This should be both unique and easily associated with the user's journey in your application(s) |
Inputs
The following table provides the details of the parameters required for the DigiLocker Fetch All Documents API's request body:
| Parameter | Mandatory / Optional | Type | Description | Input Format | Default Value |
|---|---|---|---|---|---|
referenceId | Mandatory | string | The reference ID generated in the initial request | Not Applicable | Not Applicable |
file | Mandatory | string | When set to yes, it returns the URL of the document file | yes or no | Not Applicable |
Request
The following code snippet demonstrates a standard curl request for the DigiLocker Fetch All Documents API:
curl --location --request POST 'https://ind-verify.hyperverge.co/api/digilocker/fetchAllDocuments' \
--header 'Content-Type: application/json' \
--header 'appId: <Enter_the_HyperVerge_appId>' \
--header 'appKey: <Enter_the_HyperVerge_appKey>' \
--header 'transactionId: <Enter_the_HyperVerge_transactionID>' \
--data-raw '{
"referenceId": "<Enter_the_Reference_ID>",
"file": "<Enter_yes_or_no>"
}'
Success Responses
The following code snippets demonstrate success responses from the DigiLocker Fetch All Documents API:
- Success Response
{
"status": "success",
"statusCode": "200",
"result": [
{
"0": {
"docId": "ADHAR",
"uri": "in.gov.uidai-ADHAR-<Unique_Aadhaar_Identifier>",
"data": {
"name": "<Name_of_the_User>",
"address": "<Address_Of_The_User>",
"dob": "<Date_Of_Birth_in_DD-MM-YYYY_Format>",
"gender": "<Gender>",
"maskedAadhaarNumber": "<Masked_Aadhaar_Number>",
"photo": "<Base64_Image_Of_The_Users_Profile_Photo>",
"file": "<Base64_Encoded_Aadhaar_File>"
}
},
"1": {
"docId": "PANCR",
"uri": "in.gov.pan-PANCR-<Unique_PAN_Identifier>",
"data": {
"number": "<PAN_Number>",
"name": "<Name_of_the_User>",
"dob": "<Date_Of_Birth_in_DD-MM-YYYY_Format>",
"address": "<Address_Of_The_User>",
"photo": "<Base64_Image_Of_The_Users_Profile_Photo>",
"file": "<Base64_Encoded_PAN_File>"
}
}
},
{}
]
}
Success Response Details
The following table outlines the details of the success response from the DigiLocker Fetch All Documents API:
| Parameter | Type | Description |
|---|---|---|
status | string | The status of the request |
statusCode | string | The HTTP status code for the response |
result | array | An array containing the document data for the user |
result[].docId | string | The document identifier, such as Aadhaar or PAN |
result[].uri | string | The URI for the document in the respective government database |
result[].data | object | The data object containing user information specific to each document |
result[].data.name | string | The name of the user |
result[].data.address | string | The complete address of the user |
result[].data.dob | string | The date of birth of the user in DD-MM-YYYY format |
result[].data.gender | string | The gender of the user |
result[].data.maskedAadhaarNumber | string | The masked Aadhaar number of the user |
result[].data.photo | string | The base64-encoded profile photo of the user |
result[].data.file | string | The base64-encoded file of the document |
result[].data.number | string | The PAN number of the user |
Error Responses
The following are some error responses from the DigiLocker Fetch All Documents API:
- Invalid Reference ID
- Empty referenceId
- Missing referenceId
- Invalid Aadhaar File
- Missing or Invalid Credentials
- Digilocker Repository Error - 1
- Digilocker Repository Error - 2
{
"status": "failure",
"statusCode": "400",
"error": {
"code": "ER_INVALID_REFID",
"message": "Please try verifying the refId"
}
}
{
"status": "failure",
"statusCode": "400",
"error": {
"code": "ER_REQ_VALIDATE",
"message": "referenceId is not allowed to be empty"
}
}
{
"status": "failure",
"statusCode": "400",
"error": {
"code": "ER_REQ_VALIDATE",
"message": "referenceId is required"
}
}
{
"status": "failure",
"statusCode": "400",
"error": {
"code": "ER_INVALID_AADHAAR_XML",
"message": "Invalid Aadhaar XML"
}
}
{
"status": "failure",
"statusCode": "401",
"error": "Missing/Invalid credentials"
}
{
"status": "failure",
"statusCode": "504",
"error": {
"code": "ER_DIGILOCKER_REPO_SERVICE_UNRESPONSIVE",
"message": "Error Connecting to digilocker. Please try again after sometime."
}
}
{
"status": "failure",
"statusCode": "504",
"error": {
"code": "ER_DIGILOCKER_REPO_SERVICE_UNPUBLISHED",
"message": "Error Connecting to digilocker. Please try again after sometime."
}
}
- Digilocker Repository Error - 3
- Digilocker Repository Error - 4
- Digilocker Repository Error - 5
- Digilocker Repository Error - 6
{
"status": "failure",
"statusCode": "504",
"error": {
"code": "ER_DIGILOCKER_REPO_SERVICE_INACTIVE",
"message": "Error Connecting to digilocker. Please try again after sometime."
}
}
{
"status": "failure",
"statusCode": "504",
"error": {
"code": "ER_DIGILOCKER_REPO_SERVICE_CONFIGERROR",
"message": "Error Connecting to digilocker. Please try again after sometime."
}
}
{
"status": "failure",
"statusCode": "504",
"error": {
"code": "ER_DIGILOCKER_REPO_SERVICE_RESPERROR",
"message": "Error Connecting to digilocker. Please try again after sometime."
}
}
{
"status": "failure",
"statusCode": "504",
"error": {
"code": "ER_DIGILOCKER_REPO_SERVICE_EXCEPTION",
"message": "Error Connecting to digilocker. Please try again after sometime."
}
}
Error Response Details
A failure or error response contains a failure status with a relevant status code and error message.
The following table lists all error responses:
| Status Code | Error Message | Error Description | Error Resolution |
|---|---|---|---|
| 400 | Please try verifying the refId | The provided referenceId is invalid | Verify and provide a valid referenceId |
| 400 | referenceId is not allowed to be empty | The referenceId parameter is provided but is empty | Provide a non-empty referenceId in the request |
| 400 | referenceId is required | The mandatory referenceId parameter is missing from the request | Provide valid referenceId in the request |
| 400 | Invalid Aadhaar XML | The Aadhaar XML file provided is invalid | Please upload a valid Aadhaar XML file |
| 401 | Missing/Invalid credentials | The request is either missing the mandatory appId and appKey combination or has invalid values | Provide valid appId and appKey credentials in the request |
| 504 | Error Connecting to digilocker. Please try again after sometime. | DigiLocker repository service is unresponsive, unpublished, inactive, has a configuration error, response error, or exception | Please try again after sometime or contact the HyperVerge team |